function pageObj(pfindByPage) {
	this.pageSize = 5;
	this.startIndex = 0;
	this.setPageInfo = 
		function setPageInfo(datas) {
			$("#page_info").empty();
			$("#page_info").html("共有&nbsp;" 
	            + datas.totalCount + "&nbsp;条数据&nbsp;&nbsp;"
	            + "每页&nbsp;" + datas.pageSize + "&nbsp;条&nbsp;当前&nbsp;"
	            + (datas.currentPageIndex + 1) + "/" + datas.indexes.length + "页");
		
		};
	this.setPageBtnClick = function setPageBtnClick(datas) {
		$("#page_first").unbind("click");
		$("#page_prev").unbind("click");
		$("#page_next").unbind("click");
		$("#page_last").unbind("click");
		$("#page_goto").unbind("click");
		
	    $("#page_first").click(function() {

	    	pageObjRef.findByPage(0);
	    	pageObjRef.startIndex = 0;
	     });
	    
		$("#page_prev").click(function () {
			var startIndex = 0;
			if (datas.currentPageIndex >= 0) {
				if (datas.indexes.length > 0) {
					startIndex = datas.indexes[datas.currentPageIndex - 1];
				}
			}
			pageObjRef.startIndex = startIndex;
			pageObjRef.findByPage(startIndex);
		});

		$("#page_next").click(function () {
			var startIndex = 0;

			if (datas.indexes.length > 0) {
				if (datas.currentPageIndex + 1 >= datas.indexes.length) {
					startIndex = datas.indexes[datas.indexes.length - 1];
				} else {
					startIndex = datas.indexes[datas.currentPageIndex + 1];
				}
				
				
			}
			pageObjRef.startIndex = startIndex;

			pageObjRef.findByPage(startIndex);
		});

		$("#page_last").click(function () {
			var startIndex = 0;
			if (datas.indexes.length > 0) {
				startIndex = datas.indexes[datas.indexes.length - 1];
		    }
			pageObjRef.startIndex = startIndex;
			pageObjRef.findByPage(startIndex);
		});

		$("#page_goto").click(function (){
			var startIndex = 0;
			if ($("#page_num").val() == null || $("#page_num").val().length == 0) {
				alert("请填写要跳转的页面!");
				return;
		    }
			
			if (isNaN($("#page_num").val())) {
				alert("页面必须是数字!");
				return;
		    }

			if ($("#page_num").val() <= 0 ) {
				alert("该页面不存在!");
				return;
			}

			startIndex = datas.indexes[$("#page_num").val()  - 1];
			pageObjRef.startIndex = startIndex;
			pageObjRef.findByPage(startIndex);
			
		});
	};
	this.findByPage = pfindByPage;
	
}


